Xbasic

FILE.CHARS_GET Function

Syntax

Character_Count as N = file_pointer.Chars_get()

Returns

Character_CountNumeric

Returns the number of characters (as opposed to bytes) in a file.

Description

Get the length of the file in characters.

Discussion

The .CHARS_GET() method returns the number of characters (as opposed to bytes) in files, taking into account the character encoding method.

Example

h = file.open("c:\r_broken.bin", FILE_RO_SHARED)
? h.bytes_get()
= 38
? h.chars_get()
= 18
? h.read(19)
= x this is a test
? h.text_encoding()
= "UTF16LE"

See Also